#include "main.h"
#include "ring_buffer.h"
#include "usart.h"

extern ring_buffer_t rbMain;
extern uint8_t rxMain;
extern uint8_t rxShell;
extern ring_buffer_t rbShell;

void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
    if (huart->Instance == USART1)
    {
        HAL_UART_Receive_IT(&huart1, (uint8_t *)&rxMain, 1);
        if (false == rb_write_byte(&rbMain, rxMain))
        {
            // 读取失败
        }
    }
    if(huart->Instance == USART2)
    {
        HAL_UART_Receive_IT(&huart2, (uint8_t *)&rxShell, 1);
        rb_write_byte(&rbShell, rxShell);
    }
}
